package com.daoeping.action;

import java.util.ArrayList;
import java.util.List;
import com.daoeping.data.Bsc_jobtype;
import com.daoeping.domain.JsonData;
import com.daoeping.service.Bsc_jobtypeService;
import com.daoeping.util.ConverntJsonData;
import com.opensymphony.xwork2.ActionSupport;

public class Bsc_jobtypeAction extends ActionSupport{

	private Bsc_jobtypeService bsc_jobtypeService;
	private JsonData jsonData;
	private List<Bsc_jobtype> bsc_jobtypeList;
	
	public Bsc_jobtypeService getBsc_jobtypeService() {
		return bsc_jobtypeService;
	}

	public void setBsc_jobtypeService(Bsc_jobtypeService bsc_jobtypeService) {
		this.bsc_jobtypeService = bsc_jobtypeService;
	}

	public List<Bsc_jobtype> getBsc_jobtypeList() {
		return bsc_jobtypeList;
	}

	public void setBsc_jobtypeList(List<Bsc_jobtype> bsc_jobtypeList) {
		this.bsc_jobtypeList = bsc_jobtypeList;
	}

	public JsonData getJsonData() {
		return jsonData;
	}

	public void setJsonData(JsonData jsonData) {
		this.jsonData = jsonData;
	}

	

	public String findAllJobType(){
		jsonData = new JsonData();
		bsc_jobtypeList = bsc_jobtypeService.findBsc_jobtypeList();	
		List <String[]> strList = new ArrayList<String[]>();
		for (Bsc_jobtype bsc_jobtype : bsc_jobtypeList) {
			String [] strarr = new String[2];
			strarr[1] = bsc_jobtype.getId()+"";
			strarr[0] = bsc_jobtype.getName();
			strList.add(strarr);
		}
		jsonData.setJsonData( new ConverntJsonData().getJsonData(strList)+"");
		return "alljobtype";
		
	}
		
	public List<Bsc_jobtype> findBsc_jobtypeList(){
		return this.bsc_jobtypeService.findBsc_jobtypeList();
	}


}
